import UNIT_MODEL from "../models/unit.model";
import DATE_MODEL from "../models/date.model";
import PRICE_MODEL from "../models/price.model";


/**
 * 根据缴费类型转换试算价格单位
 *
 * @param {string} paymentType
 * @return {*}  {string}
 */
function getPriceUnit(paymentType: string) : string {
    return PRICE_MODEL[paymentType]
}

/**
 * 获取试算因子日期单位
 *
 * @param {number} unitCode
 * @return {*}  {string}
 */
function getDateUnit(unitCode: number): string {
    return DATE_MODEL[unitCode];
}

/**
 * 获取试算因子单位
 *
 * @param {number} unitCode
 * @return {*}  {string}
 */
 function getGeneUnit(unitCode: number): string {
    return UNIT_MODEL[unitCode];
}

/**
 * 获取某一个试算信息
 *
 * @template T
 * @template K
 * @param {T} trialData
 * @param {K} key
 * @return {*} 
 */
function getGeneList<T extends object, K extends keyof T >(trialData:T, key: K) {
    return trialData[key];
}

export {
    getGeneList,
    getGeneUnit,
    getDateUnit,
    getPriceUnit,
};
